<template>
	<view class="">
		<u-navbar placeholder autoBack bgColor="transparent"></u-navbar>
		<view class="usertop flex align-center justify-center">
			<u-image src="/static/logo.png" width="168rpx" height="188rpx"></u-image>
		</view>

		<view class="mt-2 mx-4" style="height: 80rpx;">
			<u-input placeholder="请输入手机号" placeholderStyle="fontSize:30rpx" shape="circle"
				:customStyle="{height:'80rpx',background:'#F5F5F5'}"></u-input>
		</view>
		<view class="flex align-center justify-center mt-5 mx-4" style="height: 80rpx;">
			<u-input v-model="code" shape="circle" placeholderStyle="fontSize:30rpx" :customStyle="{height:'80rpx',background:'#F5F5F5'}"
				placeholder="请输入验证码" clearable>
				<template slot="suffix">
					<u-code ref="uCode" @change="codeChange" seconds="20" changeText="X秒重新获取"></u-code>
					<view class="font-28" style="color: #04BF79;" @click="getCode">{{tips}}</view>
				</template>
		
			</u-input>
		</view>
		
		<view class="mt-5 mx-4" style="height: 80rpx;">
			<u-input placeholder="请设置登录密码" placeholderStyle="fontSize:30rpx" shape="circle"
				:customStyle="{height:'80rpx',background:'#F5F5F5'}"></u-input>
		</view>



		<commonButton title="登录" :background="isable?'#04BF79':'#C3FFC3'" @click="login"></commonButton>

	

	</view>
</template>

<script>
	export default {
		data() {
			return {
				account: '',
				password: '',
				password:'',
				code: '',
				tips: '',
				openId: ''
			}
		},
		computed: {
			isable() {
				if (!uni.$u.test.isEmpty(this.account) && !uni.$u.test.isEmpty(this.password) && !uni.$u.test.isEmpty(this.code)) {
					return true
				} else {
					return false
				}

			}
		},
		methods: {
			codeChange(text) {
				this.tips = text;
			},
			getCode() {
				if (this.$refs.uCode.canGetCode) {
					// 模拟向后端请求验证码
					uni.showLoading({
						title: '正在获取验证码'
					})
					setTimeout(() => {
						uni.hideLoading();
						// 这里此提示会被this.start()方法中的提示覆盖
						uni.$u.toast('验证码已发送');
						// 通知验证码组件内部开始倒计时
						this.$refs.uCode.start();
					}, 2000);
				} else {
					uni.$u.toast('倒计时结束后再发送');
				}
			},
			submit() {

			},
			login() {

			},
			


		}
	}
</script>

<style>
	.usertop {
		/* background: url(@/static/bg/login.png) no-repeat; */
		background-size: 100% 272rpx;
		height: 272rpx;
	}
</style>